package others;

/**
 * @date 2020/5/13 21:12
 */
public class B extends A {
    @Override
    public void add() {
        System.out.println("子类重写");
    }

    public void delete(){
        System.out.println("子类特有");
    }

    public static void main(String[] args) {
        A a = new B();
        a.add();

        if(a instanceof B){
            B b = (B) a;
            b.add();
            ((B) a).delete();
            b.delete();
        }
        ((B)a).add();
        ((A)a).add();


    }
}

